home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / javax / swing / JFrame.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  6.5 KB  |  279 lines

  1. package javax.swing;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.Frame;
  6. import java.awt.Graphics;
  7. import java.awt.GraphicsConfiguration;
  8. import java.awt.HeadlessException;
  9. import java.awt.Image;
  10. import java.awt.LayoutManager;
  11. import java.awt.event.WindowEvent;
  12. import javax.accessibility.Accessible;
  13. import javax.accessibility.AccessibleContext;
  14. import sun.awt.SunToolkit;
  15.  
  16. public class JFrame extends Frame implements WindowConstants, Accessible, RootPaneContainer, TransferHandler.HasGetTransferHandler {
  17.    public static final int EXIT_ON_CLOSE = 3;
  18.    private static final Object defaultLookAndFeelDecoratedKey = new StringBuffer("JFrame.defaultLookAndFeelDecorated");
  19.    private int defaultCloseOperation = 1;
  20.    private TransferHandler transferHandler;
  21.    protected JRootPane rootPane;
  22.    protected boolean rootPaneCheckingEnabled = false;
  23.    protected AccessibleContext accessibleContext = null;
  24.  
  25.    public JFrame() throws HeadlessException {
  26.       this.frameInit();
  27.    }
  28.  
  29.    public JFrame(GraphicsConfiguration var1) {
  30.       super(var1);
  31.       this.frameInit();
  32.    }
  33.  
  34.    public JFrame(String var1) throws HeadlessException {
  35.       super(var1);
  36.       this.frameInit();
  37.    }
  38.  
  39.    public JFrame(String var1, GraphicsConfiguration var2) {
  40.       super(var1, var2);
  41.       this.frameInit();
  42.    }
  43.  
  44.    protected void frameInit() {
  45.       this.enableEvents(72L);
  46.       this.setLocale(JComponent.getDefaultLocale());
  47.       this.setRootPane(this.createRootPane());
  48.       this.setBackground(UIManager.getColor("control"));
  49.       this.setRootPaneCheckingEnabled(true);
  50.       if (isDefaultLookAndFeelDecorated()) {
  51.          boolean var1 = UIManager.getLookAndFeel().getSupportsWindowDecorations();
  52.          if (var1) {
  53.             this.setUndecorated(true);
  54.             this.getRootPane().setWindowDecorationStyle(1);
  55.          }
  56.       }
  57.  
  58.       SunToolkit.checkAndSetPolicy(this, true);
  59.    }
  60.  
  61.    protected JRootPane createRootPane() {
  62.       JRootPane var1 = new JRootPane();
  63.       var1.setOpaque(true);
  64.       return var1;
  65.    }
  66.  
  67.    protected void processWindowEvent(WindowEvent var1) {
  68.       super.processWindowEvent(var1);
  69.       if (var1.getID() == 201) {
  70.          switch (this.defaultCloseOperation) {
  71.             case 0:
  72.             default:
  73.                break;
  74.             case 1:
  75.                this.setVisible(false);
  76.                break;
  77.             case 2:
  78.                this.dispose();
  79.                break;
  80.             case 3:
  81.                System.exit(0);
  82.          }
  83.       }
  84.  
  85.    }
  86.  
  87.    public void setDefaultCloseOperation(int var1) {
  88.       if (var1 != 0 && var1 != 1 && var1 != 2 && var1 != 3) {
  89.          throw new IllegalArgumentException("defaultCloseOperation must be one of: DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, DISPOSE_ON_CLOSE, or EXIT_ON_CLOSE");
  90.       } else {
  91.          if (this.defaultCloseOperation != var1) {
  92.             if (var1 == 3) {
  93.                SecurityManager var2 = System.getSecurityManager();
  94.                if (var2 != null) {
  95.                   var2.checkExit(0);
  96.                }
  97.             }
  98.  
  99.             int var3 = this.defaultCloseOperation;
  100.             this.defaultCloseOperation = var1;
  101.             this.firePropertyChange("defaultCloseOperation", var3, var1);
  102.          }
  103.  
  104.       }
  105.    }
  106.  
  107.    public int getDefaultCloseOperation() {
  108.       return this.defaultCloseOperation;
  109.    }
  110.  
  111.    public void setTransferHandler(TransferHandler var1) {
  112.       TransferHandler var2 = this.transferHandler;
  113.       this.transferHandler = var1;
  114.       SwingUtilities.installSwingDropTargetAsNecessary(this, this.transferHandler);
  115.       this.firePropertyChange("transferHandler", var2, var1);
  116.    }
  117.  
  118.    public TransferHandler getTransferHandler() {
  119.       return this.transferHandler;
  120.    }
  121.  
  122.    public void update(Graphics var1) {
  123.       this.paint(var1);
  124.    }
  125.  
  126.    public void setJMenuBar(JMenuBar var1) {
  127.       this.getRootPane().setMenuBar(var1);
  128.    }
  129.  
  130.    public JMenuBar getJMenuBar() {
  131.       return this.getRootPane().getMenuBar();
  132.    }
  133.  
  134.    protected boolean isRootPaneCheckingEnabled() {
  135.       return this.rootPaneCheckingEnabled;
  136.    }
  137.  
  138.    protected void setRootPaneCheckingEnabled(boolean var1) {
  139.       this.rootPaneCheckingEnabled = var1;
  140.    }
  141.  
  142.    protected void addImpl(Component var1, Object var2, int var3) {
  143.       if (this.isRootPaneCheckingEnabled()) {
  144.          this.getContentPane().add(var1, var2, var3);
  145.       } else {
  146.          super.addImpl(var1, var2, var3);
  147.       }
  148.  
  149.    }
  150.  
  151.    public void remove(Component var1) {
  152.       if (var1 == this.rootPane) {
  153.          super.remove(var1);
  154.       } else {
  155.          this.getContentPane().remove(var1);
  156.       }
  157.  
  158.    }
  159.  
  160.    public void setLayout(LayoutManager var1) {
  161.       if (this.isRootPaneCheckingEnabled()) {
  162.          this.getContentPane().setLayout(var1);
  163.       } else {
  164.          super.setLayout(var1);
  165.       }
  166.  
  167.    }
  168.  
  169.    public JRootPane getRootPane() {
  170.       return this.rootPane;
  171.    }
  172.  
  173.    protected void setRootPane(JRootPane var1) {
  174.       if (this.rootPane != null) {
  175.          this.remove(this.rootPane);
  176.       }
  177.  
  178.       this.rootPane = var1;
  179.       if (this.rootPane != null) {
  180.          boolean var2 = this.isRootPaneCheckingEnabled();
  181.  
  182.          try {
  183.             this.setRootPaneCheckingEnabled(false);
  184.             this.add(this.rootPane, "Center");
  185.          } finally {
  186.             this.setRootPaneCheckingEnabled(var2);
  187.          }
  188.       }
  189.  
  190.    }
  191.  
  192.    public void setIconImage(Image var1) {
  193.       super.setIconImage(var1);
  194.    }
  195.  
  196.    public Container getContentPane() {
  197.       return this.getRootPane().getContentPane();
  198.    }
  199.  
  200.    public void setContentPane(Container var1) {
  201.       this.getRootPane().setContentPane(var1);
  202.    }
  203.  
  204.    public JLayeredPane getLayeredPane() {
  205.       return this.getRootPane().getLayeredPane();
  206.    }
  207.  
  208.    public void setLayeredPane(JLayeredPane var1) {
  209.       this.getRootPane().setLayeredPane(var1);
  210.    }
  211.  
  212.    public Component getGlassPane() {
  213.       return this.getRootPane().getGlassPane();
  214.    }
  215.  
  216.    public void setGlassPane(Component var1) {
  217.       this.getRootPane().setGlassPane(var1);
  218.    }
  219.  
  220.    public Graphics getGraphics() {
  221.       JComponent.getGraphicsInvoked(this);
  222.       return super.getGraphics();
  223.    }
  224.  
  225.    public void repaint(long var1, int var3, int var4, int var5, int var6) {
  226.       if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
  227.          RepaintManager.currentManager(this).addDirtyRegion(this, var3, var4, var5, var6);
  228.       } else {
  229.          super.repaint(var1, var3, var4, var5, var6);
  230.       }
  231.  
  232.    }
  233.  
  234.    public static void setDefaultLookAndFeelDecorated(boolean var0) {
  235.       if (var0) {
  236.          SwingUtilities.appContextPut(defaultLookAndFeelDecoratedKey, Boolean.TRUE);
  237.       } else {
  238.          SwingUtilities.appContextPut(defaultLookAndFeelDecoratedKey, Boolean.FALSE);
  239.       }
  240.  
  241.    }
  242.  
  243.    public static boolean isDefaultLookAndFeelDecorated() {
  244.       Boolean var0 = (Boolean)SwingUtilities.appContextGet(defaultLookAndFeelDecoratedKey);
  245.       if (var0 == null) {
  246.          var0 = Boolean.FALSE;
  247.       }
  248.  
  249.       return var0;
  250.    }
  251.  
  252.    protected String paramString() {
  253.       String var1;
  254.       if (this.defaultCloseOperation == 1) {
  255.          var1 = "HIDE_ON_CLOSE";
  256.       } else if (this.defaultCloseOperation == 2) {
  257.          var1 = "DISPOSE_ON_CLOSE";
  258.       } else if (this.defaultCloseOperation == 0) {
  259.          var1 = "DO_NOTHING_ON_CLOSE";
  260.       } else if (this.defaultCloseOperation == 3) {
  261.          var1 = "EXIT_ON_CLOSE";
  262.       } else {
  263.          var1 = "";
  264.       }
  265.  
  266.       String var2 = this.rootPane != null ? this.rootPane.toString() : "";
  267.       String var3 = this.rootPaneCheckingEnabled ? "true" : "false";
  268.       return super.paramString() + ",defaultCloseOperation=" + var1 + ",rootPane=" + var2 + ",rootPaneCheckingEnabled=" + var3;
  269.    }
  270.  
  271.    public AccessibleContext getAccessibleContext() {
  272.       if (this.accessibleContext == null) {
  273.          this.accessibleContext = new AccessibleJFrame(this);
  274.       }
  275.  
  276.       return this.accessibleContext;
  277.    }
  278. }
  279.